A Step-by-Step Guide to Creating a Pull Request in GitHub

A Step-by-Step Guide to Creating a Pull Request in GitHub

Clock Icon2023.08.09

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Hi, this is Charu from Classmethod. This is a short hands-on blog, where we'll walk through the process of creating a pull request in GitHub.

Pull requests are essential part of Github. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

Step 1:

Use the cd command to navigate into your repository's directory.

Step 2:

Create a new branch for your changes. A common practice is to name your branch based on the feature you're working on or the issue you're addressing. Use the following command to create a new branch:


git checkout -b new-feature

Step 3:

Make the necessary changes to the code. After making changes, stage your changes using the following command:


git add .

Then, commit your changes with a descriptive commit message:


git commit -m "Add new feature: description of changes"

Step 4:

Push your changes to the repository on GitHub using the following command:


git push origin new-feature

Step 5:

  • Now we will move ahead to create the Pull request.
  • Open your respective repository on GitHub.
  • Click the Pull Requests tab, then click the green New Pull Request button.
  • Set the base repository and branch (the repository you made changes in and the branch you want to merge into). GitHub will show you a comparison of changes.
  • Provide a clear title and description for your pull request. Explain the changes you made, why they are necessary, and any relevant context.
  • You can assign the reviewer to review your code changes.
  • Click the Create Pull Request button to submit your pull request.
  • Step 6:

    Collaborators and maintainers of the original repository will review your pull request. They might suggest changes, ask questions, or provide feedback. Based on feedback, make any necessary changes to your branch. Commit and push those changes to update your pull request. Once your changes are approved, a maintainer of the repository will merge your pull request into the main branch.

    You can view your Pull Request like this-

    So now you've successfully created a pull request on GitHub. These are the general steps outlined that will give you a solid foundation to start contributing to open-source projects using pull requests.

    Thank you for reading!

    Happy Learning:)

    Share this article

    facebook logohatena logotwitter logo

    © Classmethod, Inc. All rights reserved.